package com.nobuyme.box.toy;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.nobuyme.box.R;
import com.nobuyme.box.util.FragmentUtils;
import com.pachong.android.baseuicomponent.activity.BaseActivity;

import butterknife.OnClick;

import static android.R.attr.fragment;

public class ToyDetailActivity extends BaseActivity {
    private String urlPic;
    public static final String DETAIL = "detail";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        hideToolbar();
    }

    public static void start(String detail,Activity activity) {
        Intent intent = new Intent(activity, ToyDetailActivity.class);
        intent.putExtra(DETAIL,detail);
        activity.startActivity(intent);
    }

    @Override
    public View createDataView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View inflate = inflater.inflate(R.layout.activity_toy_detail, null);
            urlPic = getIntent().getStringExtra(DETAIL);
            ToyDetailFragment fragment = new ToyDetailFragment();
            Bundle bundle = new Bundle();
            bundle.putString(DETAIL,urlPic);
            fragment.setArguments(bundle);
            FragmentUtils.replaceFragment(getSupportFragmentManager(), R.id.fl_rent_detail, fragment);
            return inflate;
    }

    @OnClick(R.id.iv_detail_back)
    public void onViewClicked() {
        finish();
    }
}
